#pragma once
#include <ncnn/net.h>
#include <vector>
#include <ncnn/cpu.h>
#include <opencv2/opencv.hpp>
#include "NcnnUtil.h"

namespace Ncnn
{
    class DbNet
    {
    public:
        DbNet();
        ~DbNet() {};

        bool read_model(std::string param_path, std::string bin_path, bool use_gpu = true);
        bool detect(cv::Mat& src, std::vector<TextBox>& results, int _target_size = 1024);

    private:
        ncnn::Net net;
        const float meanValues[3] = { 0.485 * 255, 0.456 * 255, 0.406 * 255 };
        const float normValues[3] = { 1.0 / 0.229 / 255.0, 1.0 / 0.224 / 255.0,
                                     1.0 / 0.225 / 255.0 };
        float boxThresh = 0.3f;
        float boxScoreThresh = 0.5f;
        float unClipRatio = 2.0f;
        int target_size;
    };
}

